home *** CD-ROM | disk | FTP | other *** search
/ Meeting Pearls 2 / Meeting Pearls Vol. II (1995)(GTI - Schatztruhe)[!].iso / Pearls / dev / Oberon_Sources / OOP_in_Oberon-2 / Oberon0.mod < prev    next >
Text File  |  1993-01-13  |  1KB  |  30 lines

  1. MODULE Oberon0;        (* HM Mar-25-92*)
  2. IMPORT OS, Viewers0, Texts0, TextFrames0;
  3. CONST ESC = 1BX;
  4. PROCEDURE Open (name: ARRAY OF CHAR): Texts0.Text;
  5.         VAR f: OS.File; r: OS.Rider; t: Texts0.Text;
  6. BEGIN NEW(t); f := OS.OldFile(name);
  7.         IF f = NIL THEN t.Clear ELSE OS.InitRider(r); r.Set(f, 0); t.Load(r) END;
  8.         RETURN t
  9. END Open;
  10. PROCEDURE Loop*;
  11.         VAR ch: CHAR; x, y: INTEGER; buttons: SET; v: Viewers0.Viewer; menu, cont: TextFrames0.Frame;
  12. BEGIN
  13.         menu := TextFrames0.NewMenu("LOG", "Viewers0.Close  Viewers0.Copy  Edit0.Store");
  14.         cont := TextFrames0.New(Open("LOG"));
  15.         v := Viewers0.New(menu, cont);
  16.         LOOP
  17.                 IF OS.AvailChars() > 0 THEN OS.ReadKey(ch);
  18.                         IF ch = ESC THEN EXIT
  19.                         ELSIF Viewers0.focus # NIL THEN Viewers0.focus.HandleKey(ch)
  20.                         END
  21.                 ELSE OS.GetMouse(buttons, x, y);
  22.                         v := Viewers0.ViewerAt(y);
  23.                         IF v # NIL THEN v.HandleMouse(x, y, buttons)
  24.                         ELSE OS.DrawCursor(x, y)
  25.                         END
  26.                 END
  27.         END
  28. END Loop;
  29. END Oberon0.
  30.